<?php
/**
 * Simple PHP Contact Form
 *
 * This file is part of the Simple PHP Contact Form which is subject to the New
 * BSD License {@see LICENSE} which you would be advised to read before using,
 * modifying or redistributing this software.
 *
 * PHP version 5.2
 *
 * @category  Simple-PHP-Contact-Form
 * @package   Application_Library
 * @author    jah <jah@jahboite.co.uk>
 * @copyright 2010 jah <jah@jahboite.co.uk>
 * @license   New BSD License {@see LICENSE}
 * @version   SVN: $Id$
 * @link      http://code.google.com/p/simple-php-contact-form/
 */


/**
 * This Validator simply extends Zend_Validate_StringLength to perform
 * canonicalisation of the input string before calling the parent isValid.
 *
 * @category  Simple-PHP-Contact-Form
 * @package   Application_Library
 * @author    jah <jah@jahboite.co.uk>
 * @copyright 2010 jah <jah@jahboite.co.uk>
 * @license   New BSD License {@see LICENSE}
 * @version   Release: @package_version@
 * @link      http://code.google.com/p/simple-php-contact-form/
 */
class Custom_Validate_StringLength extends Zend_Validate_StringLength
{
    /**
     * Performs canonicalisation of the input string before calling parent::isValid.
     *
     * @param string $value The input string to be validated.
     *
     * @return bool True if the input is of a valid length, otherwise
     *              False.
     */
    public function isValid($value)
    {
        return parent::isValid(ESAPI::getEncoder()->canonicalize($value, false));
    }
}
